#pragma once
#include "XmlChild.h"
#include "XmlNode.h"
#include "XmlElement.h"

class XmlDocument
{
protected:
	wstring statement;
	XmlElement *rootElem;
	wchar_t chTemp[1024];
public:

	XmlDocument();

	XmlElement* GetRootElem();

	ERROR_CODE ReadIn(wstring strFilePath);

	// Parse the document and generate a DOM tree
	ERROR_CODE Parse(wchar_t* wbuf, int iwLen);

	// The name of the node and the Attribute of It will be returned, Even if it's not a node. 
	ERROR_CODE ParseNode(wchar_t* wbuf, int iwLen, int& iIndex, wstring& name, ATTRIBUTES& attr);

	bool hasStatement(wchar_t* wbuf, int iwLen, int &iIndex);

	void OutPut(wstring strFilePath);

	~XmlDocument(void);
};
